@section('title')
  账号激活 @parent
@show
@section('content')
<div class="navbar theme-white">
  <div class="navbar-inner">
    <div class="left"><a href="{{ route('home') }}" class="back link icon-only"> <i class="icon icon-back"></i><span>返回</span></a></div>
    <div class="center sliding">我们</div>
    
  </div>
</div>
<div class="pages">
    <div data-page="modal" class="page">
    <div class="page-content">
    </div>
    </div>
</div>
    
@stop

@section('bodyEnd')
<script>
@if ( !$user->active ) 
	@if ($user->phone)
		myApp.modal({
		    title: '验证码已发送',
		    text: '<input id="active_phone_regcode" placeholder="手机验证码">',
		    buttons:[
		        {
		            text:'重发',
		            onClick: function(){
			            $$.get( "{{ route('home.activeagain', $user->id) }}", function(){
			            	myApp.alert('验证码已经发送到您的手机');
			            	location.reload();
			            });
		            }
		        },
		        {
		            text:'提交',
		            onClick: function(){
			            var val = $$('#active_phone_regcode').val();
			            if ( val == ''){
							myApp.alert('请输入验证码！');
				            return;
			            }
		            	location.href=(new String("{{ route('home.activation','__token__') }}")).replace('__token__',val);
		            }
		        },
		        {
		            text:'取消',
		            onClick: function(){            
		            	location.href= '{{ route('index') }}';
		                
		            }
		        }
		    ]
		});
	@else
myApp.modal({
    title: '账号未激活',
    text: '请查收邮件激活您的账号',
    buttons:[
        {
            text:'登陆邮箱',
            onClick: function(){
                location.href= '//mail.{{ $email_domain }}';
            }
        },
        {
            text:'回首页',
            onClick: function(){
                location.href= '{{ route('index') }}';
            }
        },
        {
            text:'重发邮件',
            onClick: function(){            
                alert('邮件已经发送，请查收邮件');
                location.href= '{{ route('home.activeagain', $user->id) }}';
            }
        }
    ]
});
	@endif
@else
myApp.modal({
    title: '账号激活状态',
    text: '请您的账号已激活',
    buttons:[
        {
            text:'进入用户中心',
            onClick: function(){
                location.href= '{{ route('center.index') }}';
            }
        }
    ]
});
@endif

</script>
@stop